Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add typescript option to generate readonly types #125

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Diggsey
Copy link

@Diggsey Diggsey commented Jun 12, 2023

It's common in typescript to avoid in-place mutations. This PR allows fully read-only types to be generated.

For object types, this could previously already be achieved via lots of annotations, but this is tedious and there was no way to apply the "readonly" modifier to maps and arrays.

@Lucretiel
Copy link
Contributor

I'm not sure I follow; we already support read-only types via the annotation. Is the idea that this is a global override that forces all types to be readonly, regardless of annotations?

@Diggsey
Copy link
Author

Diggsey commented Jun 17, 2023

As I mentioned above, the annotations only allow you to make object properties read only. They don't allow you to make eg readonly string[].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants